package com.warm.middle.schedule.quartz.simple;

import com.warm.middle.schedule.ScheduleService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @Date: 2019/12/3 15:55
 * @Author: LChuang
 * @Description: 继承QuartzJobBean并重写executeInternal方法，与之前的实现Job接口类似
 */
public class SimpleJob extends QuartzJobBean {

    @Autowired
    ScheduleService scheduleService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        scheduleService.print();
        System.out.println("Exec, Hi : " + jobExecutionContext.getJobDetail().getKey());
    }
}
